﻿@model SubmitReturnRequestModel
@using Nop.Web.Models.Order;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.ReturnItems").Text);
}
<div class="page return-request-page">
    <div class="page-title">
        <h1>@string.Format(T("ReturnRequests.Title").Text, Model.OrderId)</h1>
    </div>
    <div class="page-body">
        @if (!String.IsNullOrEmpty(Model.Result))
        {
            <div class="result">
                @Model.Result</div>
        }
        else
        {
            
            <div class="section-title">@T("ReturnRequests.SelectProduct(s)")</div>
            using (Html.BeginForm())
            {

                if (Model.Items.Count > 0)
                {
            <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                @foreach (var item in Model.Items)
                {   
                    <li>
                        <div class="products-box">
                            <div class="product">
                                <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details">@item.ProductName</a>
                                @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                {
                                    <div class="attributes">
                                        @Html.Raw(item.AttributeInfo)
                                    </div>
                                }
                            </div>
                            <div class="price">
                                @T("ReturnRequests.Products.Price"): @item.UnitPrice
                            </div>
                            <div class="qty" data-role="fieldcontain">
                                <fieldset data-role="controlgroup" data-type="horizontal">
                                    <span>@T("ReturnRequests.Products.Quantity"):</span>
                                    <br />
                                    <select name="quantity@(item.Id)">
                                        @for (int i = 0; i <= item.Quantity; i++)
                                        {
                                            <option value="@(i)">@(i)</option>
                                        }
                                    </select>
                                </fieldset>
                            </div>
                        </div>
                    </li>
                }
            </ul>
                }
            <div class="section-title">
                @T("ReturnRequests.WhyReturning")</div>
            <div class="why">
                <div>
                    @Html.LabelFor(model => model.ReturnReason)
                    @Html.DropDownListFor(model => model.ReturnReason, Model.AvailableReturnReasons, new { @class = "return-reasons" })
                </div>
                <div>
                    @Html.LabelFor(model => model.ReturnAction)
                    @Html.DropDownListFor(model => model.ReturnAction, Model.AvailableReturnActions, new { @class = "return-actions" })
                </div>
                <div>
                    @Html.LabelFor(model => model.Comments)
                    @Html.TextAreaFor(model => model.Comments, new { @class = "comment" })
                </div>
                <div>
                    @Html.ValidationMessageFor(model => model.Comments)
                </div>
                <input type="submit" name="submit-return-request" value="@T("ReturnRequests.Submit")" />
            </div>
            }
        }
    </div>
</div>
